def test_view_servers(): httpretty.register_uri(httpretty.GET, NEW_RELIC_REGEX, body=VIEW_SERVERS_SAMPLE, status=200) # When I make an API request to view servers c = Client(account_id="1", api_key="2") # Then I should receive an array of Servers result = c.view_servers() result.should.be.an('list') result.should.have.length_of(2) result[0].should.be.an('pyrelic.Server') result[0].overview_url.should.equal( 'https://rpm.newrelic.com/accounts/1/servers/555') result[0].hostname.should.equal('my-hostname.newrelic.com') result[0].server_id.should.equal('555') result[1].should.be.an('pyrelic.Server') result[1].overview_url.should.equal( 'https://rpm.newrelic.com/accounts/1/servers/556') result[1].hostname.should.equal('my-hostname-2.newrelic.com') result[1].server_id.should.equal('556')
def test_view_servers(): """ Client should be able to list Servers """ httpretty.register_uri(httpretty.GET, NEW_RELIC_REGEX, body=VIEW_SERVERS_SAMPLE, status=200 ) # When I make an API request to view servers c = Client(account_id="1", api_key="2") # Then I should receive an array of Servers result = c.view_servers() result.should.be.an('list') result.should.have.length_of(2) result[0].should.be.an('pyrelic.Server') result[0].overview_url.should.equal('https://rpm.newrelic.com/accounts/1/servers/555') result[0].hostname.should.equal('my-hostname.newrelic.com') result[0].server_id.should.equal('555') result[1].should.be.an('pyrelic.Server') result[1].overview_url.should.equal('https://rpm.newrelic.com/accounts/1/servers/556') result[1].hostname.should.equal('my-hostname-2.newrelic.com') result[1].server_id.should.equal('556')