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
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "up-python"
version = "0.1.1-dev"
version = "0.1.2-dev"
description = "Language specific uProtocol library for building and using UUri, UUID, UAttributes, UTransport, and more."
authors = ["Neelam Kushwah <neelam.kushwah@gm.com>"]
license = "The Apache License, Version 2.0"
Expand All @@ -15,13 +15,11 @@ packages = [{ include = "uprotocol" },
[tool.poetry.dependencies]
python = "^3.8"
cloudevents = "*"
multipledispatch = "*"
multimethod = "*"
gitpython = ">=3.1.41"
googleapis-common-protos = ">=1.56.4"
protobuf = "4.24.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"



build-backend = "poetry.core.masonry.api"
4 changes: 2 additions & 2 deletions scripts/pull_and_compile_protos.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

REPO_URL = "https://github.com/eclipse-uprotocol/up-core-api.git"
PROTO_REPO_DIR = os.path.abspath("../target")
TAG_NAME = "uprotocol-core-api-1.5.6"
TAG_NAME = "uprotocol-core-api-1.5.7"
PROTO_OUTPUT_DIR = os.path.abspath("../uprotocol/proto")


Expand All @@ -44,7 +44,7 @@ def clone_or_pull(repo_url, PROTO_REPO_DIR):
print(f"Repository cloned successfully from {repo_url} to {PROTO_REPO_DIR}")
# Checkout the specific tag
repo.git.checkout(TAG_NAME)
except git.exc.GitCommandError as clone_error:
except git.exc.GitCommandError:
try:
git_pull_command = ["git", "pull", "origin", TAG_NAME]
subprocess.run(git_pull_command, cwd=PROTO_REPO_DIR, check=True)
Expand Down
343 changes: 252 additions & 91 deletions tests/test_cloudevent/test_datamodel/test_ucloudevent.py

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions tests/test_cloudevent/test_datamodel/test_ucloudeventattributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ def test_to_string(self):
expected = "UCloudEventAttributes{hash='somehash', priority=UPRIORITY_CS1, ttl=3, token='someOAuthToken'}"
self.assertEqual(expected, str(u_cloud_event_attributes))

def test_create_valid_with_blank_traceparent(self):
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_hash("somehash").with_priority(
UPriority.UPRIORITY_CS1).with_ttl(3).with_token("someOAuthToken").with_traceparent(" ").build()
self.assertTrue(u_cloud_event_attributes.get_hash() is not None)
self.assertEqual("somehash", u_cloud_event_attributes.get_hash())
self.assertFalse(u_cloud_event_attributes.get_traceparent() is not None)

def test_create_empty_with_only_traceparent(self):
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_traceparent("someTraceParent").build()
self.assertFalse(u_cloud_event_attributes.get_hash() is not None)
self.assertFalse(u_cloud_event_attributes.get_priority() is not None)
self.assertFalse(u_cloud_event_attributes.get_token() is not None)
self.assertFalse(u_cloud_event_attributes.get_ttl() is not None)
self.assertTrue(u_cloud_event_attributes.get_traceparent() is not None)
self.assertFalse(u_cloud_event_attributes.is_empty())
self.assertEqual("someTraceParent", u_cloud_event_attributes.get_traceparent())

def test_create_valid(self):
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_hash("somehash").with_priority(
UPriority.UPRIORITY_CS6).with_ttl(3).with_token("someOAuthToken").build()
Expand Down
Loading