How to calculate margin of error for a binomial quality control experiment where only successes are observed (including FPC)? Wikipedia's Margin of Error entry says that 

a random sample of size 400 will give a margin of error, at a 95%
  confidence level, of 0.98/20 or 0.049 - just under 5%

given an infinite population size. This means that if I polled 400 US citizens (randomly selected) and asked them "Obama or Romney?", the resulting proportion would be accurate with a 95% confidence level, to a margin of error below 5%.
However, can I use this same calculation in testing that a software program will be able to deal with roughly all inputs?
For example: I have an infinite population of users, I need to be sure (95% confident, given 5% error) that my software will be able to come up with a nickname for all of them based on their name and a simple algorithm.
If I randomly select 400 users, and the nickname algorithm works perfectly for all 400 users, can I assume (with 95% confidence, given 5% error) that my algorithm holds for the entire population? Is this the incorrect way to calculate margin of error for this type of problem?
 A: The 0.049 calculation from Wikipedia only applies if the probability of success is 0.5 ($1.96\times\sqrt{\frac{0.5\times0.5}{400}}$).  This isn't the case in your situation; but the good news is that as probability of success gets closer to zero or one the margin of error for any particular sample size gets smaller.
You are interested in estimating the probability of success (let's call it $p$) and in particular a 95 percent confidence interval for it.
The chance of seeing no failures in $n$ experiments is $p^n$ so for example if you set 0.99 as a possible value of $p$ the chance of seeing 400 successes is only $0.99^{400}=0.017$.  This is pretty small so normally we would say that this is evidence against p being as low as 0.99, whereas it is perfectly consistent with p=1 which is what you want.  But p could still plausibly be as high as (for example) 0.999 - because 67% of the time, if p=0.999, 400 random trials will all be successes, even though this might be unacceptably low success rate for your overall population.
To cut a long story short, if you have a run of successes you can estimate a 95 percent confidence interval with ($e^{(\frac{log(0.05)}{n})}, 1]$.  So if you plug the value of n=400 into this (because you had 400 successes) you find the confidence interval is (0.9925, 1].  It is up to you to determine whether a rate of success that could plausibly be as low 0.9925 is good enough for your purposes.
EDIT - addition on finite population
In my comments I noted that the above formula for the lower bound of the confidence interval came from solving $0.05=p^n$ for $p$.  If you have a finite population you have the more complex challenge of solving the equation below for p:
$0.05=\frac{Np}{N}\times \frac{Np-1}{N-1}\times ... \frac{Np-n+1}{N-n+1}$
There may be a solution to this but I found it easier to write a function in R that does it for me iteratively, and returns an interval of (0.9945, 1] if you have 400 trials out of a finite population of 1000.  The function test() below can be used for any combination of number of trials and population size.
tmp <- function(N,n,p){
    x <- 1
    f <- round(N*p)
    for (i in 0:(n-1)){
        x <- x * (f-i) / (N-i)
    }
x
}

test <- function(N,n){
    p <- exp(log(0.05)/n) # start with infinite N
    incr <- n/N * 0.00001
    x <- tmp(N, n,p)
    while(x <0.05){
    x <- tmp(N, n,p)
    p <- p + incr
    }
p
}

> test(10^10,400)
[1] 0.9925386
> test(1000,400)
[1] 0.9945066
> test(450,400)
[1] 0.9966809

A: What you are doing or can do is generate a 95% exact confidence interval for the proportion in the population that will properly generate a nickname.  The interval you get when there are only successes will be [p, 1].  You can interpret this to mean that this procedure when taking a sample of size 400 repeatedly will include the true proportion approximately 95% of the time or more.  So you have strong confidence to think that the proportion is greater than p. 
