Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions at_client/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@dataclass
class Metadata:
ttl: int = 0
ttln: int = 0
ttb: int = 0
ttr: int = 0
ccd: bool = False
Expand Down Expand Up @@ -43,6 +44,7 @@ def from_json(json_str):
data = json.loads(json_str)
metadata = Metadata()
metadata.ttl = data.get('ttl')
metadata.ttl = data.get('ttln')
metadata.ttb = data.get('ttb')
metadata.ttr = data.get('ttr')
metadata.ccd = data.get('ccd')
Expand Down Expand Up @@ -74,6 +76,7 @@ def from_json(json_str):
def from_dict(data_dict):
metadata = Metadata()
metadata.ttl = data_dict.get('ttl', 0)
metadata.ttln = data_dict.get('ttln', 0)
metadata.ttb = data_dict.get('ttb', 0)
metadata.ttr = data_dict.get('ttr', 0)
metadata.ccd = data_dict.get('ccd', False)
Expand Down Expand Up @@ -106,6 +109,8 @@ def __str__(self):
s = ""
if self.ttl:
s += f":ttl:{self.ttl}"
if self.ttln:
s += f":ttln:{self.ttln}"
if self.ttb:
s += f":ttb:{self.ttb}"
if self.ttr:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "atsdk"
version = "0.1.0"
version = "0.2.0"
description = "Python SDK for atPlatform"
authors = ["Umang Shah <shahumang19@gmail.com>","Chris Swan <chris@atsign.com>"]
maintainers = ["Chris Swan <chris@atsign.com>"]
Expand Down
10 changes: 10 additions & 0 deletions test/verbbuilder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,15 @@ def test_notify_verb_builder(self):
command_without_id = re.sub(r'\bid:[^:]*:', '', command)
self.assertRegex(command_without_id, "notify:update:ttl:1000:ttr:-1:isEncrypted:true:@bob:test.dave@alice:valuevaluevalue")


#with a shared key, with metadata and namespace (no caching)
sk = SharedKey("test", AtSign("@alice"), AtSign("@bob"))
metadata = Metadata(ttln="1000")
sk.metadata = metadata
sk.namespace = ".dave"
command = NotifyVerbBuilder().with_at_key(sk, "valuevaluevalue").build()
command_without_id = re.sub(r'\bid:[^:]*:', '', command)
self.assertRegex(command_without_id, "notify:update:ttln:1000:isEncrypted:true:@bob:test.dave@alice:valuevaluevalue")

if __name__ == '__main__':
unittest.main()