This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Gh 20 travis python
- Loading branch information
Showing
7 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ target/ | |
.idea | ||
*/.classpath | ||
__pycache__ | ||
*.pem | ||
*.pem | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# Copyright 2016 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the 'License'); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an 'AS IS' BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import unittest | ||
|
||
from gafferpy import gaffer as g | ||
from gafferpy import gaffer_connector | ||
|
||
|
||
class GafferConnectorTest(unittest.TestCase): | ||
def test_execute_operation(self): | ||
gc = gaffer_connector.GafferConnector('http://localhost:8080/rest/v1') | ||
elements = gc.execute_operation( | ||
g.GetElements( | ||
seeds=[ | ||
g.EntitySeed('M5:10') | ||
], | ||
view=g.View( | ||
edges=[ | ||
g.ElementDefinition( | ||
group='JunctionLocatedAt' | ||
) | ||
] | ||
) | ||
) | ||
) | ||
|
||
self.assertEqual( | ||
[g.Edge("JunctionLocatedAt", "M5:10", "390466,225615", True, {})], | ||
elements) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Copyright 2016 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the 'License'); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an 'AS IS' BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import unittest | ||
|
||
import example | ||
|
||
|
||
class ExampleTest(unittest.TestCase): | ||
def test_example_does_not_error(self): | ||
example.run('http://localhost:8080/rest/v1') | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# Copyright 2016 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the 'License'); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an 'AS IS' BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import unittest | ||
|
||
from gafferpy import gaffer as g | ||
|
||
|
||
class GafferTest(unittest.TestCase): | ||
def test_create_edge_seed(self): | ||
self.assertEqual( | ||
{ | ||
'class': 'uk.gov.gchq.gaffer.operation.data.EdgeSeed', | ||
'source': 'src', | ||
'destination': 'dest', | ||
'directed': 'DIRECTED' | ||
}, | ||
g.EdgeSeed("src", "dest", g.DirectedType.DIRECTED).to_json() | ||
) | ||
|
||
self.assertEqual( | ||
{ | ||
'class': 'uk.gov.gchq.gaffer.operation.data.EdgeSeed', | ||
'source': 'src', | ||
'destination': 'dest', | ||
'directed': 'UNDIRECTED' | ||
}, | ||
g.EdgeSeed("src", "dest", g.DirectedType.UNDIRECTED).to_json() | ||
) | ||
|
||
self.assertEqual( | ||
{ | ||
'class': 'uk.gov.gchq.gaffer.operation.data.EdgeSeed', | ||
'source': 'src', | ||
'destination': 'dest', | ||
'directed': 'EITHER' | ||
}, | ||
g.EdgeSeed("src", "dest", g.DirectedType.EITHER).to_json() | ||
) | ||
|
||
self.assertEqual( | ||
{ | ||
'class': 'uk.gov.gchq.gaffer.operation.data.EdgeSeed', | ||
'source': 1, | ||
'destination': 2, | ||
'directed': 'DIRECTED' | ||
}, | ||
g.EdgeSeed(1, 2, True).to_json() | ||
) | ||
|
||
self.assertEqual( | ||
{ | ||
'class': 'uk.gov.gchq.gaffer.operation.data.EdgeSeed', | ||
'source': 1, | ||
'destination': 2, | ||
'directed': 'UNDIRECTED' | ||
}, | ||
g.EdgeSeed(1, 2, False).to_json() | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |