Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
10f4e09
Smoke Test Sample for Track 2 libraries
JonathanCrd Jul 17, 2019
d6e763c
simpleQuery method added
JonathanCrd Jul 17, 2019
45e9699
Method's names updated
JonathanCrd Jul 17, 2019
1b5ef9a
Create README.md
JonathanCrd Jul 19, 2019
aee43e1
Update README.md
JonathanCrd Jul 19, 2019
97e4f60
Commented lines deleted
JonathanCrd Jul 19, 2019
c587a82
README.md moved to correct folder
JonathanCrd Jul 19, 2019
7909abd
Create requirements.txt
JonathanCrd Jul 22, 2019
1d393e6
Update README.md
JonathanCrd Jul 22, 2019
81d389e
Update README.md
JonathanCrd Jul 23, 2019
ab8fa9d
Imports changed
JonathanCrd Jul 23, 2019
e7f7346
Use of literals instead of append
JonathanCrd Jul 23, 2019
7066da0
Database Name variable to class level.
JonathanCrd Jul 23, 2019
81adc4c
Use of Pythonic with statements
JonathanCrd Jul 23, 2019
4b79c6a
Update requirements.txt
JonathanCrd Jul 23, 2019
a3df531
Revert "Update requirements.txt"
JonathanCrd Jul 23, 2019
27b2a2d
Revert "Use of Pythonic with statements"
JonathanCrd Jul 23, 2019
4c2d73d
Revert "Revert "Use of Pythonic with statements""
JonathanCrd Jul 23, 2019
15e025e
requiriments.txt encoded as a txt file
JonathanCrd Jul 23, 2019
3d9ce90
requirements.txt as text file
JonathanCrd Jul 23, 2019
22927ad
Misspelling in "Key concepts"
JonathanCrd Jul 23, 2019
17a53cb
Update .docsettings.yml to match the tittle of Smoke Test
JonathanCrd Jul 23, 2019
35c6223
Went trought Suyog comments
JonathanCrd Jul 24, 2019
ada5a74
Revert "Went trought Suyog comments"
JonathanCrd Jul 24, 2019
ff419ff
Gone trought Suyog comments
JonathanCrd Jul 24, 2019
e2190c9
use of snake case in file names
JonathanCrd Jul 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Revert "Use of Pythonic with statements""
This reverts commit 27b2a2d.
  • Loading branch information
JonathanCrd committed Jul 23, 2019
commit 4c2d73def2cd26a3006ab37c98be287cd9414c2f
33 changes: 17 additions & 16 deletions samples/smoketest/EventHubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@ def GetPartitionIds(self):
return partition_ids

def SendAndReceiveEvents(self, partitionID):
consumer = self.client.create_consumer(consumer_group="$default", partition_id=partitionID, event_position=EventPosition(datetime.utcnow()))
with self.client.create_consumer(consumer_group="$default", partition_id=partitionID, event_position=EventPosition(datetime.utcnow())) as consumer:

print("Sending events...")
producer = self.client.create_producer(partition_id=partitionID)
event_list = [EventData(b"Test Event 1 in Python"),EventData(b"Test Event 2 in Python"),EventData(b"Test Event 3 in Python")]
producer.send(event_list)
producer.close()
print("\tdone")

print("Receiving events...")
received = consumer.receive(max_batch_size=len(event_list), timeout=2)
for event_data in received:
print("\tEvent Received: " + event_data.body_as_str())
consumer.close()
print("\tdone")
print("Sending events...")
with self.client.create_producer(partition_id=partitionID) as producer:
event_list = [
EventData(b"Test Event 1 in Python"),
EventData(b"Test Event 2 in Python"),EventData(b"Test Event 3 in Python")]
producer.send(event_list)
print("\tdone")

print("Receiving events...")
received = consumer.receive(max_batch_size=len(event_list), timeout=2)
for event_data in received:
print("\tEvent Received: " + event_data.body_as_str())

print("\tdone")

if(len(received) != len(event_list)):
raise Exception("Error, expecting {0} events, but {1} were received.".format(str(len(event_list)),str(len(received))))
if(len(received) != len(event_list)):
raise Exception("Error, expecting {0} events, but {1} were received.".format(str(len(event_list)),str(len(received))))

def Run(self):
print()
Expand Down