示例#1
0
  def test_job_should_emit_results_for_all_urls(self):
    first_domain = Domain("http://example.com")
    first_img_url = Image("http://example.com/1.png")
    second_img_url = Image("http://example.com/2.png")
    third_img_url = Image("http://example.com/3.png")

    first_domain.images.extend([first_img_url, second_img_url, third_img_url])

    second_domain = Domain("http://example.com/2")
    fourth_img_url = Image("http://example.com/4.png")
    second_domain.images.extend([fourth_img_url])

    job = Job([first_domain,second_domain])

    self.assertEqual(job.get_results(), {
        "id": job.id,
        "domains":{
            "http://example.com":[
                "http://example.com/1.png",
                "http://example.com/2.png",
                "http://example.com/3.png"
            ],
            "http://example.com/2":[
                "http://example.com/4.png"
            ]
        }
    })