Tests for review manipulations
This commit is contained in:
parent
98e90ffb64
commit
e44f86a939
@ -246,6 +246,48 @@ class TestApiCalls(unittest.TestCase):
|
||||
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title /><description /><build><disable /></build></package>')
|
||||
self.assertEqual(httpretty.last_request().path, '/source/openSUSE:Factory:Staging:B/wine/_meta')
|
||||
|
||||
@httpretty.activate
|
||||
def test_adding_review(self):
|
||||
"""
|
||||
Test whether adding review behaves correctly
|
||||
"""
|
||||
|
||||
with mock_generate_ring_packages():
|
||||
api = oscs.StagingAPI('http://localhost')
|
||||
|
||||
self._register_pretty_url_get('http://localhost/request/123',
|
||||
'request_in_review.xml')
|
||||
httpretty.register_uri(
|
||||
httpretty.POST, "http://localhost/request/123")
|
||||
|
||||
api.add_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().body, 'Being evaluated by staging project "openSUSE:Factory:Staging:A"')
|
||||
self.assertEqual(httpretty.last_request().path, '/request/123?cmd=addreview&by_project=openSUSE%3AFactory%3AStaging%3AA')
|
||||
api.add_review('123', 'openSUSE:Factory:Staging:B')
|
||||
self.assertEqual(httpretty.last_request().method, 'GET')
|
||||
|
||||
@httpretty.activate
|
||||
def test_accepting_review(self):
|
||||
"""
|
||||
Test whether accepting review behaves correctly
|
||||
"""
|
||||
|
||||
with mock_generate_ring_packages():
|
||||
api = oscs.StagingAPI('http://localhost')
|
||||
|
||||
self._register_pretty_url_get('http://localhost/request/123',
|
||||
'request_in_review.xml')
|
||||
httpretty.register_uri(
|
||||
httpretty.POST, "http://localhost/request/123", body=self._get_fixture_content('request_in_review.xml'))
|
||||
|
||||
api.set_review('123', 'openSUSE:Factory:Staging:B')
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().body, 'Reviewed by staging project "openSUSE:Factory:Staging:B" with result: "accepted"')
|
||||
self.assertEqual(httpretty.last_request().path, '/request/123?newstate=accepted&cmd=changereviewstate&by_project=openSUSE%3AFactory%3AStaging%3AB')
|
||||
api.set_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'GET')
|
||||
|
||||
@httpretty.activate
|
||||
def test_check_project_status_green(self):
|
||||
"""
|
||||
|
26
tests/fixtures/request_in_review.xml
vendored
Normal file
26
tests/fixtures/request_in_review.xml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<request id="123">
|
||||
<action type="submit">
|
||||
<source project="home:Admin" package="puppet" rev="59f0f46262d7b57b9cdc720c06d5e317"/>
|
||||
<target project="openSUSE:Factory" package="puppet"/>
|
||||
</action>
|
||||
<state name="review" who="Admin" when="2014-02-17T12:38:52">
|
||||
<comment>Passed staging project "openSUSE:Factory:Staging:test"</comment>
|
||||
</state>
|
||||
<review state="new" when="2014-02-17T12:34:10" who="Admin" by_project="openSUSE:Factory:Staging:B">
|
||||
<comment>Passed staging project "openSUSE:Factory:Staging:test"</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-02-17T12:36:42" who="Admin" by_project="openSUSE:Factory:Staging:A">
|
||||
<comment>Passed staging project "openSUSE:Factory:Staging:test"</comment>
|
||||
</review>
|
||||
<history name="review" who="Admin" when="2014-02-17T12:34:10">
|
||||
<comment>Being evaluated by staging project "openSUSE:Factory:Staging:B"</comment>
|
||||
</history>
|
||||
<history name="new" who="Admin" when="2014-02-17T12:35:55">
|
||||
<comment>Passed staging project "openSUSE:Factory:Staging:A"</comment>
|
||||
</history>
|
||||
<history name="review" who="Admin" when="2014-02-17T12:36:42">
|
||||
<comment>Being evaluated by staging project "openSUSE:Factory:Staging:A"</comment>
|
||||
</history>
|
||||
<description>test</description>
|
||||
</request>
|
Loading…
x
Reference in New Issue
Block a user